package com.joysuch.wwyt.baidu.req;

import com.baidu.aip.face.AipFace;
import com.joysuch.wwyt.util.ApplicationContextHolder;

public class BaiduSample {

        //设置APPID/AK/SK
        public static  String APP_ID;
        public static  String API_KEY;
        public static  String SECRET_KEY;

        public static AipFace client;

        public static void init() {
            // 初始化一个AipFace
            APP_ID = ApplicationContextHolder.getApplicationContext().getEnvironment().getProperty("wwyt.thirdparty.baidu.face-id.app-id");
            API_KEY = ApplicationContextHolder.getApplicationContext().getEnvironment().getProperty("wwyt.thirdparty.baidu.face-id.app-key");
            SECRET_KEY = ApplicationContextHolder.getApplicationContext().getEnvironment().getProperty("wwyt.thirdparty.baidu.face-id.secret");
            client = new AipFace(APP_ID, API_KEY, SECRET_KEY);

            // 可选：设置网络连接参数
            client.setConnectionTimeoutInMillis(2000);
            client.setSocketTimeoutInMillis(60000);

            // 可选：设置代理服务器地址, http和socket二选一，或者均不设置
//            client.setHttpProxy("proxy_host", proxy_port);  // 设置http代理
//            client.setSocketProxy("proxy_host", proxy_port);  // 设置socket代理

    }

}
